#include<bits/stdc++.h>
using namespace std;
string a, b;
int ans, t;
int main()
{
	getline(cin, a);
	getline(cin, b);
	a.insert(0, " ");
	b.insert(0, " ");
	transform(a.begin(), a.end(), a.begin(), ::tolower);
	transform(b.begin(), b.end(), b.begin(), ::tolower);
	a = a + ' ';
	if (b.find(a) == -1)
		cout << "-1";
	else
	{
		int n = 0;
		while (b.find(a, n) != -1)
		{
			n = b.find(a, n) + 1;
			ans++;
		}
		cout << ans << " " << b.find(a);
	}
	return 0;
}